/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tkatva.soalog.SoalogEjb.entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author tuomas
 */
@Entity
@Table(name = "log_fields")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LogFields.findAll", query = "SELECT l FROM LogFields l")})
public class LogFields implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "log_field_id")
    private Integer logFieldId;
    @Size(max = 50)
    @Column(name = "log_field_name")
    private String logFieldName;
    @Size(max = 100)
    @Column(name = "element_name")
    private String elementName;
    @Size(max = 5000)
    @Column(name = "xml_xpath")
    private String xmlXpath;
    @JoinColumn(name = "log_interface_log_interface_id", referencedColumnName = "log_interface_id")
    @ManyToOne(optional = false)
    private LogInterface logInterfaceLogInterfaceId;

    public LogFields() {
    }

    public LogFields(Integer logFieldId) {
        this.logFieldId = logFieldId;
    }

    public Integer getLogFieldId() {
        return logFieldId;
    }

    public void setLogFieldId(Integer logFieldId) {
        this.logFieldId = logFieldId;
    }

    public String getLogFieldName() {
        return logFieldName;
    }

    public void setLogFieldName(String logFieldName) {
        this.logFieldName = logFieldName;
    }

    public String getElementName() {
        return elementName;
    }

    public void setElementName(String elementName) {
        this.elementName = elementName;
    }

    public String getXmlXpath() {
        return xmlXpath;
    }

    public void setXmlXpath(String xmlXpath) {
        this.xmlXpath = xmlXpath;
    }

    public LogInterface getLogInterfaceLogInterfaceId() {
        return logInterfaceLogInterfaceId;
    }

    public void setLogInterfaceLogInterfaceId(LogInterface logInterfaceLogInterfaceId) {
        this.logInterfaceLogInterfaceId = logInterfaceLogInterfaceId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (logFieldId != null ? logFieldId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LogFields)) {
            return false;
        }
        LogFields other = (LogFields) object;
        if ((this.logFieldId == null && other.logFieldId != null) || (this.logFieldId != null && !this.logFieldId.equals(other.logFieldId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tkatva.soalog.SoalogEjb.entities.LogFields[ logFieldId=" + logFieldId + " ]";
    }
    
}
